// import 'package:gongguanapp/config/config.dart';

import 'package:pax_info_app/config/constants.dart';

///地址数据
class Address {

  static final baseUrl = 'https://info2api.paxsz.com/api';

  static final kLogin = baseUrl + '/Hr_Employee/login';
  static final kLogout = baseUrl + '/Hr_Employee/Logout';
  static final kHomeGet = baseUrl + '/Home/Get?newsNums=20&fileNums=20&bbsNums=20';
  static final kUserInfo = baseUrl + '/Clock/GetUserInfo?UserNo={1}&FDate={2}';
  static final kMatchPerson = baseUrl + '/Clock/MatchPerson';
  static final kGetClockDateList = baseUrl + '/Clock/GetClockDateList';
  static final kGetClockList = baseUrl + '/Clock/GetClockList?UserNo={1}&FDate={2}';

  /// 刷新token
  static final kRefreshToken = baseUrl + '/user/refreshToken?refreshToken={1}';



  static addArgs(String url, List args) {
    String temp = url;

    for (int i = 0; i < args.length; i++) {
      String item = args[i] == null ? '' : args[i].toString();
      temp = temp.replaceFirst('{' + (i + 1).toString() + '}', item);
    }
    return temp;
//    return temp + '&token=' + UserInfo.instance.getToken();
  }

  static imgAddHost(String img) {
    return baseUrl + '/' + img;
  }

  static postUrl(String entry) {
    if (entry.substring(0, 1) == '/') entry = entry.substring(1);
    return baseUrl + '/' + entry;
  }
}
